How to Enable Multilingual Support

About

The configuration file must be used only as an example and it should not be modified because it will be overwritten at upgrade time.

  • The configuration settings for multilingual support can be found in the file \modules\SmartHubResourceLoader\DefaultModuleSettings.js around line 635.
  • The setting for custom Multi-language support in the provided custom Index and Results settings files (.js) is around line 170-180.

How to Configure the Multi-language Component

  1. Open the file DefaultModuleSettings.js.
  2. Open your page's custom settings file. See How to Use the UI Builder.
  3. Copy the configuration settings from the file DefaultModuleSettings.js around line 635 the into the custom settings file for your page.
    1. Modify the settings as desired.
    2. Custom settings files are stored (by default) in <SmartHub_Install_dir>\CustomerCustomization\settings.
      1. Make a copy of this directory before modifying its contents as the original directory is overwritten at upgrade time.

  4. All the changes to the settings must be done by way of the custom settings file created for the page, such as ResultsCopyCustomSettings.js.

Settings

Setting Name

Default Value

Description

EnableLanguage true

true - Multi-Language is enabled

false - Multi-Language is disabled

DefaultLanguage en-US A string value representing the main language of the SH configuration
LanguageRedirects "/"

A list of mappings key:value where:

  • key is the name of the language
  • value is the ULR to redirect to
LanguagePickerParentContent ".coveo-header-zone" system setting
TemplatePath SH.RootLevelURL + '/modules/MultiLanguage/template/LanguagePickerTemplate.html' Path to multi-language HTML template

Example

Copy
module.exports = {
        EnableLanguage: true,
        DefaultLanguage: "en-US",
        LanguageRedirects: {
            "en-US": "/",
            "de-DE": "/de",
            "fr-FR": "/fr"        },
        LanguagePickerParentContent: ".coveo-header-zone",
        TemplatePath: SH.RootLevelURL + '/modules/MultiLanguage/template/LanguagePickerTemplate.html',
    }

How to Create a Dictionary

  1. Go to the directory <SmartHub_install_dir>/js/cultures/.
  2. Make a copy of file en.smarthub.js.
  3. Change the first two letters (en) with you language. 
    For example, de.smarthub.js.
  4. Open your new file and translate every label from the file.
  5. Save the file in the directory <SmartHub_install_dir>/js/cultures/.

Example:

How to Create Your Site for a Specific Language

There are two ways to archive this. If you want to have different sites for each language, follow these steps:

  1. Make a copy of your SmartHub site.
  2. Open IIS.
  3. Go to your SmartHub site and right click on it.
  4. Select Add Application.
  5. In the pop-up window:
    1. Set the Alias as the Key of the language. For example: de.
    2. Set the physical path as the path to the copy of SmartHub you created in Step 1.
    3. Click OK.

How to Organize Language Files 

If you want to keep all language js files in the same folder in your SmartHub, follow these steps:

  1. Open IIS.
  2. Go to your SmartHub site and right click on it.
  3. Select Add Virtual Directory.
  4. In the pop-up window:
    1. Set the Alias as the Key of the language. For example: de.
    2. Set the physical path as the path to your SmartHub.
    3. Click OK.
  5. Right click on the newly created Virtual Directory (de).
  6. Click on Convert to Application.

How to Redirect SmartHub to a Specific Language

  1. Go to Landing page.
  2. From the drop-down menu, select the language:

How to Add a New Language in Language Picker

  1. Go to the directory /modules/LanguagePicker/template
  2. Using a text editor, open LanguagePickerTemplate.html file
  3. Add the new language option (for example <option value="fr-FR">France</option>)

How to Add a Dictionary for Spell Check

The spellchecker functionality is based on the file dictionaries stored in the Dictionary sub-folder in your SmartHub installation directory.

By default, only the English dictionary is delivered.

  1. Additional ones can be downloaded fromhttps://github.com/hermitdave/FrequencyWords/tree/master/content/2018
  2. Copy all the values for your specific language in a text file.
  3. Rename the file to the specific language configured in the Multi-Language module (Example: for Germany - de-DE).
  4. Place the file in the Dictionary folder to provide multi-language spell checking.